package com.asia5b.a5mall.middleware.api

import com.asia5b.a5mall.middleware.model.base.ResultModel
import com.asia5b.a5mall.middleware.model.shop.*
import io.reactivex.Observable
import okhttp3.ResponseBody
import retrofit2.http.*

/**
 * Created by zhangyuncai on 2019/12/21.
 */
interface ShopApi {

    /**
     * @Note   查看会员是否收藏店铺
     * @param   id    要检索的收藏店铺id
     */
    @GET("members/collection/shop/{id}")
    fun getIsCollectionShop(@Path("id") id: Int): Observable<ShopCollectModel>


    /** ============================== 店铺分组相关API  =============================== */


    /**
     * @Note   查询店铺分组列表
     * @param   shopId    店铺id
     */
    @GET("shops/cats/{shop_id}")
    fun getShopCats(@Path("shop_id") shopId: Int): Observable<ArrayList<ShopCategoryModel>>


    /** ============================== 店铺相关API  =============================== */

    /**
     * @Note   查询店铺列表
     * @param   pageNo    页码
     * @param   pageSize    分页数
     * @param   name    店铺名称
     * @param   order    按好评率排序
     */
    @GET("shops/list")
    fun getShopList(
            @Query("page_no") pageNo: Int,
            @Query("page_size") pageSize: Int,
            @Query("name") name: String,
            @Query("order") order: Int = 0): Observable<ResultModel<ArrayList<AbsShopModel>>>


    /**
     * @Note   获取店铺信息(未登录状态)
     * @param   shopId    店铺id
     */
    @GET("shops/{shop_id}")
    fun getShop(@Path("shop_id") shopId: Int): Observable<AbsShopModel>


    /** ============================== 店铺幻灯片相关API  =============================== */

    /**
     * @Note   查询店铺幻灯片列表
     * @param   shopId    店铺id
     */
    @GET("shops/sildes/{shop_id}")
    fun getSildes(@Path("shop_id") shopId: Int): Observable<ResponseBody>

    @GET("shops/apply")
    fun getShopsApply(): Observable<ApplyShopResModel>

    @POST("shops/apply")
    fun getApplyShopState(): Observable<ApplyShopStateModel>

    /**
     * @note /shops/apply/step1
     * @note /shops/apply/step2
     * @note /shops/apply/step3
     * @note /shops/apply/step4
     */
    @PUT("shops/apply/{step}")
    fun putShopsApply(@Path("step") step: String, @QueryMap map: HashMap<String, Any>): Observable<ApplyShopResModel>

}